package view.component.monster.large_monster
{
	import enums.main.UISize;
	
	import feathers.controls.Label;
	import feathers.data.ListCollection;
	
	import model.vo.monster.LMonsterAttackVo;
	
	import view.component.BaseSCListView;
	import view.render.monster.LMonsterAttackListItem;
	
	
	/**
	 * 大型怪物详细-攻击方式界面
	 * @author £iang
	 * 
	 */	
	public class LMDetailAttackView extends BaseSCListView
	{
		//-----------------------------
		// variables
		//-----------------------------
		
		/** 伤害标题 */
		public var damageTitle:Label;
		/** 属性标题 */
		public var attributeTitle:Label;
		/** 威力标题 */
		public var powerTitle:Label;
		/** 气绝标题 */
		public var dizzyTitle:Label;
		/** 参考标题 */
		public var psTitle:Label;
		
		//-----------------------------
		// properties
		//-----------------------------
		
		//-----------------------------
		// setter&getter
		//-----------------------------
		
		//-----------------------------
		// methods
		//-----------------------------
		
		/**
		 * 初始化函数 
		 * 
		 */		
		override protected function initialize():void
		{ 
			_itemH = UISize.LMONSTER_ATK_ITEM_H * this.dpiScale;
			_listH = UISize.MAIN_H - 
				( UISize.MONSTER_TAB_AREA_H + 
					UISize.LMONSTER_DETAIL_TAB_AREA_H +
					UISize.LIST_TITLE_H ) * this.dpiScale;
			_scrollerMaxPage = 2;
			_firstName = "攻击方式";
			super.initialize();
		}
		
		override protected function initializeOther():void
		{
			super.initializeOther();
			damageTitle = new Label();
			damageTitle.text = "伤害";
			damageTitle.textRendererProperties.wordWrap = true;
			scollerContainer.addChild( damageTitle );
			
			attributeTitle = new Label();
			attributeTitle.text = "属性";
			attributeTitle.textRendererProperties.wordWrap = true;
			scollerContainer.addChild( attributeTitle );
			
			powerTitle = new Label();
			powerTitle.text = "威力值";
			powerTitle.textRendererProperties.wordWrap = true;
			scollerContainer.addChild( powerTitle );
			
			dizzyTitle = new Label();
			dizzyTitle.text = "气绝值";
			dizzyTitle.textRendererProperties.wordWrap = true;
			scollerContainer.addChild( dizzyTitle );
			
			psTitle = new Label();
			psTitle.text = "参考";
			psTitle.textRendererProperties.wordWrap = true;
			scollerContainer.addChild( psTitle );
		}
		
		/**
		 * 绘制函数 
		 * 
		 */		
		override protected function draw():void
		{
			var labelY:Number = ( UISize.LIST_TITLE_H - 
				43 ) / 2 * this.dpiScale;
			var leftPadding:Number = UISize.TITLE_PADDING_LEFT * this.dpiScale;
			var firstLabelFullW:Number;
			
			firstTitle.y = labelY;
			firstTitle.x = leftPadding;
			firstLabelFullW = UISize.MAIN_W * 0.5;
			firstTitle.width = firstLabelFullW - leftPadding;
			
			scollerContainer.x = firstLabelFullW;
			scollerContainer.width = UISize.MAIN_W - firstLabelFullW;
			scollerContainer.height = UISize.LIST_TITLE_H;
			
			damageTitle.y = labelY;
			damageTitle.x = 0;
			damageTitle.width  = UISize.MAIN_W / 4;
			
			attributeTitle.y = labelY;
			attributeTitle.x = UISize.MAIN_W / 4;
			attributeTitle.width  = UISize.MAIN_W / 4;
			
			powerTitle.y = labelY;
			powerTitle.x = UISize.MAIN_W / 2;
			powerTitle.width  = UISize.MAIN_W / 4;
			
			dizzyTitle.y = labelY;
			dizzyTitle.x = UISize.MAIN_W * 0.75;
			dizzyTitle.width  = UISize.MAIN_W / 4;
			
			psTitle.y = labelY;
			psTitle.x = UISize.MAIN_W;
			psTitle.width  = UISize.MAIN_W / 2;
			
			var buttonY:Number = ( UISize.LIST_TITLE_H * this.dpiScale - leftButton.height ) / 2;
			
			leftButton.x = firstLabelFullW - leftButton.width;
			leftButton.y = buttonY;
			
			rightButton.x = UISize.MAIN_W - leftButton.width;
			rightButton.y = buttonY;
			
			list.y = UISize.LIST_TITLE_H * this.dpiScale;
		}
		
		/**
		 * 设置列表数据 
		 * @param dataVec 数据
		 * 
		 */		
		public function setListData( dataVec:Vector.<LMonsterAttackVo> ):void
		{
			var i:int;
			var len:int = dataVec.length;
			
			_listData = new ListCollection([]);
			
			for( i = 0; i < len; i++)
			{
				var item:LMonsterAttackListItem = new LMonsterAttackListItem();
				var tmpData:LMonsterAttackVo = dataVec[ i ] as LMonsterAttackVo;
				
				item.setData( tmpData );
				_listData.push( { item:item, itemData:tmpData } );
			}
			
			list.dataProvider = _listData;
		}
		
		//-----------------------------
		// events
		//-----------------------------
		
		//-----------------------------
		// dispose
		//-----------------------------
		
		/**
		 * 析构函数 
		 * 
		 */		
		protected override function disposeAnythingInContainer():void
		{
			disposeLabels( [
				"damage", "attribute", "power",
				"dizzy", "ps"
			] );
		}
		
		//-----------------------------
		// construction
		//-----------------------------
		
		/**
		 * 构造函数
		 *
		 */
		public function LMDetailAttackView()
		{
			super();
		}
	}
}